<script src="/vendor/laravel-admin-ext/echarts/echarts.min.js"></script>
<div class="row">
    <div class="col-md-12">
        <div class="box box-info">
            <div style="height: 600px;">
                <div id="conversion-echart" style="width: 100%;height:100%;">加载中....</div>
            </div>
           <br/>
        </div>
    </div>
</div>

<script>
    var myChart_patent = echarts.init(document.getElementById('conversion-echart'));
    var   option = {
        xAxis: {
            type: 'category',
            data: []
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: [@foreach($types as $type_id=>$name){{$count[$type_id]??0}}, @endforeach],
            type: 'bar'
        }]
    };
    //@foreach($types as $type) //
    option.xAxis.data.push("{{$type}}");
    //@endforeach //

    $(function () {
        $('.start_date').datetimepicker({"format":"YYYY-MM-DD","locale":"zh-CN"});
        $('.end_date').datetimepicker({"format":"YYYY-MM-DD","locale":"zh-CN","useCurrent":false});
        $(".start_date").on("dp.change", function (e) {
            $('.end_date').data("DateTimePicker").minDate(e.date);
        });
        $(".end_date").on("dp.change", function (e) {
            $('.start_date').data("DateTimePicker").maxDate(e.date);
        });

        myChart_patent.setOption(option, true);
    });
    function test(){
        option.dataset.source.forEach((val,index)=>{
            val["发明专利"] = 100;
        })
        myChart_patent.setOption(option, true);
    }
</script>